<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Ext 2.0 Desktop Sample App</title>

    <link rel="stylesheet" type="text/css" href="ext2.0/resources/css/ext-all.css" />
    <!-- GC -->
 	<!-- LIBS -->
 	<script type="text/javascript" src="ext2.0/adapter/ext/ext-base.js"></script>
 	<!-- ENDLIBS -->

    <script type="text/javascript" src="ext2.0/ext-all.js"></script>

    <!-- DESKTOP -->
    <script type="text/javascript" src="js/extjs/StartMenu.js"></script>
    <script type="text/javascript" src="js/extjs/TaskBar.js"></script>
    <script type="text/javascript" src="js/extjs/Desktop.js"></script>
    <script type="text/javascript" src="js/extjs/App.js"></script>
    <script type="text/javascript" src="js/extjs/Module.js"></script>
	
	<!-- sampleDesktop is where everything happens -->
    <script type="text/javascript" src="js/sampleDesktop.js"></script>
	
	<!-- TEST STUFF -->
	<link rel="STYLESHEET" href="css/stylesMozilla.css?LDGBN">
	<SCRIPT src="js/protaculous/prototype.js" language="JavaScript" type=text/javascript></SCRIPT>
	<SCRIPT src="js/protaculous/scriptaculous.js?load=effects,dragdrop" language="JavaScript" type="text/javascript"></SCRIPT>
	<SCRIPT src="js/jsCommon.js" language="JavaScript" type=text/javascript></SCRIPT>	    
	<SCRIPT src="js/jsResources.js" language="JavaScript" type=text/javascript></SCRIPT>

    <link rel="stylesheet" type="text/css" href="css/desktop.css" />
	<script language="JavaScript">
		function jScriptInit() {
			initToolTips();		
					}
			
				
		// remote scripting library
		// (c) copyright 2005 modernmethod, inc
		var sajax_debug_mode = false;
		var sajax_request_type = "POST";
		var sajax_target_id = "";
		var sajax_failure_redirect = "";
		
		function sajax_debug(text) {
			if (sajax_debug_mode)
				alert(text);
		}
		
 		function sajax_init_object() {
 			sajax_debug("sajax_init_object() called..")
 			
 			var A;
 			
 			var msxmlhttp = new Array(
				'Msxml2.XMLHTTP.5.0',
				'Msxml2.XMLHTTP.4.0',
				'Msxml2.XMLHTTP.3.0',
				'Msxml2.XMLHTTP',
				'Microsoft.XMLHTTP');
			for (var i = 0; i < msxmlhttp.length; i++) {
				try {
					A = new ActiveXObject(msxmlhttp[i]);
				} catch (e) {
					A = null;
				}
			}
 			
			if(!A && typeof XMLHttpRequest != "undefined")
				A = new XMLHttpRequest();
			if (!A)
				sajax_debug("Could not create connection object.");
			return A;
		}
		
		var sajax_requests = new Array();
		
		function sajax_cancel() {
			for (var i = 0; i < sajax_requests.length; i++) 
				sajax_requests[i].abort();
		}
		
		function sajax_do_call(func_name, args) {
			var i, x, n;
			var uri;
			var post_data;
			var target_id;
			
			sajax_debug("in sajax_do_call().." + sajax_request_type + "/" + sajax_target_id);
			target_id = sajax_target_id;
			if (typeof(sajax_request_type) == "undefined" || sajax_request_type == "") 
				sajax_request_type = "GET";
			
			uri = "/admin/resources.php";
			if (sajax_request_type == "GET") {
			
				if (uri.indexOf("?") == -1) 
					uri += "?rs=" + escape(func_name);
				else
					uri += "&rs=" + escape(func_name);
				uri += "&rst=" + escape(sajax_target_id);
				uri += "&rsrnd=" + new Date().getTime();
				
				for (i = 0; i < args.length-1; i++) 
					uri += "&rsargs[]=" + escape(args[i]);

				post_data = null;
			} 
			else if (sajax_request_type == "POST") {
				post_data = "rs=" + escape(func_name);
				post_data += "&rst=" + escape(sajax_target_id);
				post_data += "&rsrnd=" + new Date().getTime();
				
				for (i = 0; i < args.length-1; i++) 
					post_data = post_data + "&rsargs[]=" + escape(args[i]);
			}
			else {
				alert("Illegal request type: " + sajax_request_type);
			}
			
			x = sajax_init_object();
			if (x == null) {
				if (sajax_failure_redirect != "") {
					location.href = sajax_failure_redirect;
					return false;
				} else {
					sajax_debug("NULL sajax object for user agent:\n" + navigator.userAgent);
					return false;
				}
			} else {
				x.open(sajax_request_type, uri, true);
				// window.open(uri);
				
				sajax_requests[sajax_requests.length] = x;
				
				if (sajax_request_type == "POST") {
					x.setRequestHeader("Method", "POST " + uri + " HTTP/1.1");
					x.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
				}
			
				x.onreadystatechange = function() {
					if (x.readyState != 4) 
						return;

					sajax_debug("received " + x.responseText);
				
					var status;
					var data;
					var txt = x.responseText.replace(/^\s*|\s*$/g,"");
					status = txt.charAt(0);
					data = txt.substring(2);

					if (status == "") {
						// let's just assume this is a pre-response bailout and let it slide for now
					} else if (status == "-") 
						alert("Error: " + data);
					else {
						if (target_id != "") 
							document.getElementById(target_id).innerHTML = eval(data);
						else {
							try {
								var callback;
								var extra_data = false;
								if (typeof args[args.length-1] == "object") {
									callback = args[args.length-1].callback;
									extra_data = args[args.length-1].extra_data;
								} else {
									callback = args[args.length-1];
								}
								callback(eval(data), extra_data);
							} catch (e) {
								sajax_debug("Caught error " + e + ": Could not eval " + data );
							}
						}
					}
				}
			}
			
			sajax_debug(func_name + " uri = " + uri + "/post = " + post_data);
			x.send(post_data);
			sajax_debug(func_name + " waiting..");
			delete x;
			return true;
		}
		
				
		// wrapper for getResources		
		function x_getResources() {
			sajax_do_call("getResources",
				x_getResources.arguments);
		}
		
				
		// wrapper for getNewResources		
		function x_getNewResources() {
			sajax_do_call("getNewResources",
				x_getNewResources.arguments);
		}
		
				
		// wrapper for addResourceCat		
		function x_addResourceCat() {
			sajax_do_call("addResourceCat",
				x_addResourceCat.arguments);
		}
		
				
		// wrapper for removeResourceCat		
		function x_removeResourceCat() {
			sajax_do_call("removeResourceCat",
				x_removeResourceCat.arguments);
		}
		
				
		// wrapper for removeOrphanedCats		
		function x_removeOrphanedCats() {
			sajax_do_call("removeOrphanedCats",
				x_removeOrphanedCats.arguments);
		}
		
				
		// wrapper for saveResource		
		function x_saveResource() {
			sajax_do_call("saveResource",
				x_saveResource.arguments);
		}
		
				
		// wrapper for deleteResource		
		function x_deleteResource() {
			sajax_do_call("deleteResource",
				x_deleteResource.arguments);
		}
		
				
		// wrapper for getResourceForEdit		
		function x_getResourceForEdit() {
			sajax_do_call("getResourceForEdit",
				x_getResourceForEdit.arguments);
		}
		
				
		// wrapper for exportResources		
		function x_exportResources() {
			sajax_do_call("exportResources",
				x_exportResources.arguments);
		}
		
				
		// wrapper for getBadLinks		
		function x_getBadLinks() {
			sajax_do_call("getBadLinks",
				x_getBadLinks.arguments);
		}
		
				
		// wrapper for search		
		function x_search() {
			sajax_do_call("search",
				x_search.arguments);
		}
		
				
		// wrapper for resourceEdit		
		function x_resourceEdit() {
			sajax_do_call("resourceEdit",
				x_resourceEdit.arguments);
		}
		
				
		// wrapper for linkCheck		
		function x_linkCheck() {
			sajax_do_call("linkCheck",
				x_linkCheck.arguments);
		}
		
				
		// wrapper for linkCheckConfirm		
		function x_linkCheckConfirm() {
			sajax_do_call("linkCheckConfirm",
				x_linkCheckConfirm.arguments);
		}
		
				
		// wrapper for submitLink		
		function x_submitLink() {
			sajax_do_call("submitLink",
				x_submitLink.arguments);
		}
		
				
		// wrapper for getLevelSelects		
		function x_getLevelSelects() {
			sajax_do_call("getLevelSelects",
				x_getLevelSelects.arguments);
		}
		
				
		// wrapper for toggleLinkStatus2		
		function x_toggleLinkStatus2() {
			sajax_do_call("toggleLinkStatus2",
				x_toggleLinkStatus2.arguments);
		}
		
				
		// wrapper for deleteLink		
		function x_deleteLink() {
			sajax_do_call("deleteLink",
				x_deleteLink.arguments);
		}
		
				
		// wrapper for resourceEditConfirm		
		function x_resourceEditConfirm() {
			sajax_do_call("resourceEditConfirm",
				x_resourceEditConfirm.arguments);
		}
		
				
		// wrapper for toggleLinkStatus		
		function x_toggleLinkStatus() {
			sajax_do_call("toggleLinkStatus",
				x_toggleLinkStatus.arguments);
		}
		</script>
</head>
<body scroll="no">

<div id="x-desktop">
    <a href="http://extjs.com" target="_blank" style="margin:5px; float:right;"><img src="images/powered.gif" /></a>

    <dl id="x-shortcuts">
        <dt id="resourceManager-shortcut">
            <a href="#"><img src="images/s.gif" />
            <div>Resource Manager</div></a>
        </dt>
        <dt id="eventManager-shortcut">
            <a href="#"><img src="images/s.gif" />
            <div>Event Manager</div></a>
        </dt>
		<dt id="siteMessages-shortcut">
            <a href="#"><img src="images/s.gif" />
            <div>Site Messages</div></a>
        </dt>
		<dt id="districtDocuments-shortcut">
            <a href="#"><img src="images/s.gif" />
            <div>District Documents</div></a>
        </dt>
		<dt id="userManager-shortcut">
            <a href="#"><img src="images/s.gif" />
            <div>User Manager</div></a>
        </dt>
    </dl>
</div>

<div id="ux-taskbar">
	<div id="ux-taskbar-start"></div>
	<div id="ux-taskbuttons-panel"></div>
	<div class="x-clear"></div>
</div>

</body>
</html>
